﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;



namespace CreateSql
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = @"     public   class UserInfo
    {
      public  int Id { get; set; }
        public string Nick { get; set; }
        public string Password { get; set; }
        public string photo { get; set; }
        public string Introduce { get; set; }

        public string Address { get; set; }
    }";
            /* str = Regex.Replace(str, @"[\r\n]", "");
             string sqlhead = "";
             string sqlbody = "";
             for (int i = 0; i < str.Length; i++)

                 if (str[i] == 'p' && str[i + 1] == 'u' && str[i + 2] == 'b' && str[i + 3] == 'l' && str[i + 4] == 'i' && str[i + 5] == 'c')
                 {
                     if (i == 0)
                     {
                         i += 13;
                         for (; ; )
                         {
                             if (str[i] == '{') break;
                             sqlhead += str[i];
                             i++;
                         }
                     }
                     else
                     {
                         string type = "";
                         string sqltype = "";
                         string sqlname = "";
                         i += 7;
                         for (; ; )
                         {
                             if (str[i] == ' ') break;
                             type += str[i];
                             i++;
                         }
                         switch (type)
                         {
                             case "string":
                                 sqltype = " nvarchar(50),\r\n";
                                 break;
                             case "bool":
                                 sqltype = " nvarchar(50),\r\n";
                                 break;
                             case "DateTime":
                                 sqltype = " datetime,\r\n";
                                 break;
                             case "decimal":
                                 sqltype = " decimal(18, 0),\r\n";
                                 break;
                             case "int":
                                 sqltype = " int,\r\n";
                                 break;
                             default:
                                 sqltype = " " + type + ",\r\n";
                                 break;
                         }
                         i++;
                         for (; ; )
                         {
                             if (str[i] == ' ') break;
                             sqlname += str[i];
                             i++;
                         }
                         sqlbody += sqlname + sqltype;
                         i += 13;
                     }
                 }

             string sql = "     create table " + sqlhead + "(\r" + sqlbody + ")";
             Console.WriteLine(sql);*/

            string ss = MD5Encrypt.Encrypt("Lq@pwd6190.", 32);
            Console.WriteLine(ss);

            Console.ReadKey();
        }
    }
}
